var CM_Function = new Object();
CM_Function.StringFormat = function(format) {

    var args = Array.prototype.slice.call(arguments, 1);
    var sprintfRegex = /\{(\d+)\}/g;

    var sprintf = function(match, number) {
        return number in args ? args[number] : match;
    };

    return format.replace(sprintfRegex, sprintf);
};

function PairSiteInfo(TabID, SiteID, Team1Key, Team1Value, Team2Key, Team2Value) {

    this.TabID = TabID;
    this.SiteID = SiteID;
    this.Team1Key = Team1Key;
    this.Team1Value = Team1Value;
    this.Team2Key = Team2Key;
    this.Team2Value = Team2Value;
    this.Clone = function() {
        return new PairSiteInfo(this.TabID, this.SiteID, this.Team1Key, this.Team1Value, this.Team2Key, this.Team2Value, this.Team1Slected);
    };
}

function SiteInfo(Team1Key, Team1Value, Team2Key, Team2Value) {
    this.Team1Key = Team1Key;
    this.Team1Value = Team1Value;
    this.Team2Key = Team2Key;
    this.Team2Value = Team2Value;
}

function PairInfo(PairId, Sites) {
    this.PairId = PairId;
    this.Sites = Sites;
}
function MatchInfo(MathId, ATabId, ASiteType, BTabId, BSiteType, Pairs) {

    this.MathId = MathId;
    this.ATabId = ATabId;
    this.ASiteType = ASiteType;
    this.BTabId = BTabId;
    this.BSiteType = BSiteType;
    this.Pairs = Pairs;
}